﻿@model List<MessageManager.Application.DTO.MessageDTO>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <title>收件箱</title>
    <script type="text/javascript" src="/../../scripts/jquery.js"></script>
    <script type="text/javascript" src="/../../scripts/lib.js"></script>
    <script type="text/javascript">
        function RemoveMsg(Id) {
            if (confirm("确认要删除吗?")) {
                $("#msg_item_" + Id).html('<td colspan="4" style="color:red">删除中......</td>');
                var param = {
                    id: Id
                };
                $.ajax({
                    url: '/message/DeleteMessage',
                    type: 'post',
                    data: JSON.stringify(param),
                    dataType: 'json',
                    contentType: 'application/json; charset=utf-8',
                    success: function (data) {
                        if (data.result == "success") {
                            $("#msg_item_" + Id).html('<td colspan="4" style="color:red">' + data.content + '</td>');
                        }
                    },
                    error: function (xhr) {
                        $("#msg_item_" + Id).html('<td colspan="4" style="color:red">' + xhr.responseText + '</td>');
                    }
                });
            }
        }
    </script>
    <link rel="stylesheet" href="/../../css/cnblogs.css" type="text/css">
</head>
<body>
    <form name="ListForm" method="post" id="ListForm">
        <div id="main_wrapper">
            <div id="sideleft">
                <div style="padding-left: 20px; width: 95%">
                    <div id="navcontainer" class="floatright" style="margin-top: 1px">
                        <ul id="navlist">
                            <li><a href="/message/inbox" class="current">收件箱</a></li>
                            <li><a href="/message/outbox">发件箱</a></li>
                        </ul>
                    </div>
                    <div class="clear"></div>
                    <div style="margin-top: 10px;">
                        <table width="100%" cellpadding="5" cellspacing="0" border="0" class="bt">
                            <tbody>
                                <tr>
                                    <td width="100px">发件人</td>
                                    <td>标题</td>
                                    <td width="150px" align="center">发送时间</td>
                                    <td width="60px" align="center" colspan="2">处理</td>
                                </tr>
                                @foreach (MessageManager.Application.DTO.MessageDTO message in Model)
                                {
                                    <tr id="msg_item_@message.ID">
                                        <td class="gray">@message.Sender.DisplayName</td>
                                        <td><a target="_blank" href="/message/recipient/@message.ID" title="@message.Title">@message.Title</a></td>
                                        <td align="center" class="gray">@message.SendTime</td>
                                        <td align="center" style="width: 40px;"><a class="click_del_off" onclick="RemoveMsg('@message.ID')" title="删除">删除</a></td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div id="sideright">
                > 当前用户：@HttpUtility.UrlDecode(Request.Cookies["DisplayName"].Value) <br />
                <br />
                > <a href="/message/compose" class="big blue">撰写新短消息</a><br />
            </div>
        </div>
    </form>
</body>
</html>
